package ooday03;

public class AnimalTest {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("老大",10,"绿");
        dogs[1] = new Dog("老二",9,"红");
//        dogs[2] = new Dog("",5,"");       //------null空的，没只想任何对象--------（根本没指向对象【有地址】）NullPointerException(空指针异常）
        System.out.println(dogs[2].name);

//        for(int i=0;i<dogs.length;i++) {
//            System.out.println(dogs[i].name+"今年"+dogs[i].age+"岁了，他是一只"+dogs[i].color+"色的狗！");
//            dogs[i].eat();
//            dogs[i].watchDoor();
//        }

//        Chicken[] chicks = new Chicken[4];
//        chicks[0] = new Chicken("大大",15,"白");
//        chicks[1] = new Chicken("大二",13,"黑");
//        chicks[2] = new Chicken("大三",12,"黄");
//        chicks[3] = new Chicken("大四",11,"蓝");
//
//        for(int i=0;i<chicks.length;i++) {
//            System.out.println(chicks[i].name+"已经"+chicks[i].age+"岁了，它非常的"+chicks[i].color+"色！");
//            chicks[i].eat();
//            chicks[i].layEggs();
//        }
//
//        Fish[] fish = new Fish[2];
//        fish[0] = new Fish("小大",10,"金");
//        fish[1] = new Fish("大鱼",5,"青");
//
//
//        for(int i=0;i<fish.length;i++) {
//            System.out.println("我是一只"+fish[i].color+"色的"+fish[i].age+"岁的小鱼："+fish[i].name);
//            fish[i].eat();
//        }

    }
}
